﻿using System.Collections.Generic;
using StructureMap;

namespace Live.Refresh.Components
{
    public static class BootStrapper
    {
        public static void Bootstrap()
        {
            ObjectFactory.Initialize(x =>
            {
                x.For<INotify>().Use<Notification>();
                x.For<ILogger>().Singleton().Use<Log2Console>();
                x.Scan(scan =>
                {
                    scan.AssembliesFromApplicationBaseDirectory();
                    scan.With(new SingeltonConvention());
                });
                x.FillAllPropertiesOfType<INotify>();
                x.FillAllPropertiesOfType<ILogger>();
            });
        }
    }
    public class Resolver
    {
        public static IEnumerable<T> Resolve<T>()
        {
            return ObjectFactory.GetAllInstances<T>();
        }
    }
}
